package xin.yangshuai.juc01.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * HttpThreadService
 *
 * @author shuai
 * @date 2025/1/17
 */
@Service
public class HttpThreadService {

    public static final Logger logger = LoggerFactory.getLogger(HttpThreadService.class);

    private Boolean blockFlag = true;

    public void threadBlock() {

        logger.info("当前线程名：{}", Thread.currentThread().getName());

        if (blockFlag) {
            try {
                TimeUnit.SECONDS.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
